package com.soft.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.soft.entity.Banji;
import com.soft.service.BanjiService;

@RestController
@RequestMapping("/banji")
public class BanjiController {
	@Autowired
	private BanjiService banjiService;
	@RequestMapping("/queryAllBanji")
	public List<Banji> queryAll(){
		return banjiService.queryAll();
	}
	@RequestMapping("/queryByTeacher")
	public List<Banji> queryByLoc(String BanjiTeacherName){
		return banjiService.queryByLoc(BanjiTeacherName);
	}
	@RequestMapping("/insertTeacher")
	public String insertOne(String banjiRenshu, String banjiTeacher) {
	    int num = banjiService.insertOne(banjiRenshu, banjiTeacher);
	    if (num == 1) {
	        return banjiTeacher + "加入成功";
	    } else {
	        return banjiTeacher+ "加入失败";
	    }
	}
	@RequestMapping("/deleteByBanjihao")
	public String deleteById(String id) {
	    int num = banjiService.deleteById(id);
	    if (num == 1) {
	        return "删除成功";
	    } else {
	        return "删除失败";
	    }
	}

}
